<!DOCTYPE html>
<html lang="en">
<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <link rel="stylesheet" href="../static/css/weui.css"/>
    <link rel="stylesheet" href="../static/css/example.css"/>
    <link rel="stylesheet" href="../static/css/jquery-weui.css"/>
    <link rel="stylesheet" href="../static/css/publish.css"/>
    <link rel="stylesheet" href="{{ url_for('static',filename='css/bootstrap.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static',filename='css/flat-ui.min.css') }}">
    <script type="text/javascript" src="../static/js/class.js"></script>
    <script type="text/javascript" src="../static/js/jquery-2.2.4.min.js"></script>
    <script type="text/javascript" src="../static/js/jquery-weui.js"></script>
    <link rel="stylesheet" href="../static/css/jquery-weui.css"/>
</head>

<body style="background-color:#EEE">
<!-- navbar -->
<nav class="navbar navbar-default navbar-Amethyst" role="navigation" style="margin:10px 0px;">
    <div class="container">
        <div class="navbar-header">
            <span class="navbar-brand">班级选择</span>
            <a href="http://jza.gangxi.xiaosikeji.com/hostel/get_class">
                <img src="../static/images/list.png" class="navbar-toggle" alt="" style="padding-top: 14px;padding-bottom: 14px;">
            </a>
        </div>

    </div>
</nav>
<!-- /navbar -->

<!-- 学院 -->
<div class="weui-cell weui-cell_select weui-cell_select-after" style="background-color: #F8F8F8">
                <div class="weui-cell__hd">
                    <label for="" class="weui-label" style="font-size: large">学院</label>
                </div>
                <div class="weui-cell__bd">
                    <select class="weui-select" name="collegeselect"  id="collegeselect" >

                    </select>
                </div>
            </div>
<!-- 专业 -->
<div class="weui-cell weui-cell_select weui-cell_select-after" style="background-color: #F8F8F8">
                <div class="weui-cell__hd">
                    <label for="" class="weui-label" style="font-size: large">专业</label>
                </div>
                <div class="weui-cell__bd">
                    <select class="weui-select" name="majorselect" id="majorselect">

                    </select>
                </div>
            </div>
<!-- 班级 -->
<div class="weui-cell weui-cell_select weui-cell_select-after" style="background-color: #F8F8F8">
                <div class="weui-cell__hd">
                    <label for="" class="weui-label" style="font-size: large">班级</label>
                </div>
                <div class="weui-cell__bd">
                    <select class="weui-select" name="classselect" id="classselect" >
{#                        onclick="setCookie('classselect',this.selectedIndex3)"#}
                    </select>
                </div>
            </div>
<!-- 日期 -->
<div class="weui-cell" style="background-color: #F8F8F8">
                <div class="weui-cell__hd"><label for="" class="weui-label" style="font-size: large">日期</label></div>
                <div class="weui-cell__bd" style="margin-left: 0px;">
                    <input class="weui-input" type="date" value="{{ nowTime }}"  id="dayselect">
                </div>
            </div>
<!-- 查询 -->
{% if classname %}
<div class="weui-btn-area" style="padding-top: 0px;background-color: burlywood;margin-left: 15px;margin-right: 15px;">
      <a type="button" id="searchhome2" class="weui-btn confirm">查询</a>
     </div>
{% else %}
<div class="weui-btn-area" style="padding-top: 0px;background-color: burlywood;margin-left: 15px;margin-right: 15px;">
      <a type="button" id="searchhome" class="weui-btn confirm">查询</a>
     </div>
{% endif %}
</body>
</html>
<script type="text/javascript">
addressInit('collegeselect', 'majorselect', 'classselect');
</script>
<script>
nowtime =$('#dayselect').val();
$(function(){
    collegename =$('#collegeselect option:first').val();
    majorname =$('#majorselect option:first').val();
    classname = $('#classselect option:first').val();
    old = '-请选择-';
$("#collegeselect").change(function(){
    collegename = $("#collegeselect option:selected").text();
});
$("#majorselect").change(function(){
    majorname = $("#majorselect option:selected").text();
});
$("#classselect").change(function(){
    classname =$("#classselect option:selected").text();
    console.log(classname,majorname,collegename)
});
$("#dayselect").change(function(){
    nowtime =$('#dayselect').val();
    console.log(nowtime)

});

});
 $('#searchhome').on("click", function () {
     if (classname ===old){
         $.toast('未选择有效信息', "forbidden");
     }
    else{
          window.location.href = "http://jza.gangxi.xiaosikeji.com/hostel/showstu?classname=" + classname + "&select_time=" + nowtime + "&majorname=" + majorname + "&collegename=" + collegename
}})

</script>
<script type="text/javascript">
    var A="{{ classname }}";
    if(A==null||A==undefined||A=="")
    {}
    else
    {
           addressInit('collegeselect', 'majorselect', 'classselect');
        $('#collegeselect option:first').text('{{ collegename }}');
        $('#majorselect option:first').text('{{ majorname }}');
        $('#classselect option:first').text('{{ classname }}');
         classname2 =$("#classselect option:selected").text();
         majorname2 = $("#majorselect option:selected").text();
         collegename2 = $("#collegeselect option:selected").text();
         console.log(classname2);
        $("#dayselect").change(function(){
            nowtime =$('#dayselect').val();
    });
        if (!nowtime){$.toast('未更改时间', "forbidden");}
        else {
        $('#searchhome2').on("click", function () {
        window.location.href = "http://jza.gangxi.xiaosikeji.com/hostel/showstu?classname=" + classname2 + "&select_time=" + nowtime + "&majorname=" + majorname2 + "&collegename=" + collegename2
     })}}
</script>
